﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manager_SummaryHome : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            clsWebShop cls = new clsWebShop();
            bool fLog = cls.IsShowReviewAutNoneProc(Session["AdminUserID"].ToString());
            if (fLog == true || Session["IsAdmin"] == "S")
            {
                pnlSummary.Visible = true;
                DataSet ds;
                string sYYMM = System.DateTime.Now.ToString("yyyyMM");
                ds = cls.GetData("select count(*) from dbo.OrderPD DH inner join shr_User as KH on KH.UserID=DH.UserID where  DH.Status ='N' and  substring(DH.UpdDate,1,6)='" + sYYMM + "'    select count(*) from dbo.OrderPD DH inner join shr_User as KH on KH.UserID=DH.UserID where  DH.Status ='Y'  and substring(DH.UpdDate,1,6)='" + sYYMM + "'     select count(*) from dbo.OrderPD DH inner join shr_User as KH on KH.UserID=DH.UserID 	where  DH.Status ='E' and substring(DH.UpdDate,1,6)='" + sYYMM + "'   select count(*) from dbo.OrderPD DH inner join shr_User as KH on KH.UserID=DH.UserID 	where  DH.Status ='C' and substring(DH.UpdDate,1,6)='" + sYYMM + "'");
                string strNew = ds.Tables[0].Rows[0][0].ToString();
                string strSign = ds.Tables[1].Rows[0][0].ToString();
                string strEnd = ds.Tables[2].Rows[0][0].ToString();
                string StrCancel = ds.Tables[3].Rows[0][0].ToString();
                string sDate = System.DateTime.Now.ToString("yyyyMM01");
                string eDate = System.DateTime.Now.ToString("yyyyMMdd");

                DataTable dtMn = new DataTable();
                dtMn = cls.GetData("select MenuID From Menu where MenuURL like '%~/Manager/OrderDetail/OrderDetail.aspx%'").Tables[0];
                string MenuID = "";
                if (dtMn.Rows.Count > 0)
                    MenuID = dtMn.Rows[0]["MenuID"].ToString();

                lblNew.Text = "<a class='lbl_CountTotalOrder' onmouseover='javascript:this.style.textDecoration =\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"' style='text-decoration:none' href='OrderDetail/OrderDetail.aspx?sDate=" + sDate + "&eDate=" + eDate + "&sState=N&CodeID=" + MenuID + "'>Tổng số đơn đang chờ duyệt trong tháng " + System.DateTime.Now.Month + " là: <font color='red'><b>" + strNew + "</b></font></a>";
                lblSign.Text = "<a class='lbl_CountTotalOrder' onmouseover='javascript:this.style.textDecoration =\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"' style='text-decoration:none'  href='OrderDetail/OrderDetail.aspx?sDate=" + sDate + "&eDate=" + eDate + "&sState=Y&CodeID=" + MenuID + "'>Tổng số đơn bạn đã duyệt trong tháng " + System.DateTime.Now.Month + " là: <font color='red'><b>" + strSign + "</b></font></a>";
                lblEnd.Text = "<a class='lbl_CountTotalOrder' onmouseover='javascript:this.style.textDecoration =\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"' style='text-decoration:none'  href='OrderDetail/OrderDetail.aspx?sDate=" + sDate + "&eDate=" + eDate + "&sState=E&CodeID=" + MenuID + "'>Tổng số đơn bạn đã xác nhận trong tháng " + System.DateTime.Now.Month + " là: <font color='red'><b>" + strEnd + "</b></font></a>";

                lblCancel.Text = "<a class='lbl_CountTotalOrder' onmouseover='javascript:this.style.textDecoration =\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"' style='text-decoration:none'  href='OrderDetail/OrderDetail.aspx?sDate=" + sDate + "&eDate=" + eDate + "&sState=C&CodeID=" + MenuID + "'>Tổng số đơn bạn đã báo phế trong tháng " + System.DateTime.Now.Month + " là: <font color='red'><b>" + StrCancel + "</b></font></a>";
            }
        }
    }
}
